package com.blog.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.blog.dto.UserEditPwd;
import com.blog.dto.UserLoginDTO;
import com.blog.entity.User;
import com.blog.vo.UserVO;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper {

    @Select("select * from tb_user")
    List<User> selectALl();

    @Select("select * from tb_user   where id = #{userId} and password = #{password}")
    User getUserByIAndPassword(UserLoginDTO userLoginDTO);

    @Select("select * from tb_user where name LIKE CONCAT('%', #{name}, '%')")
    List<User> getUserByName(@Param("name") String name);
    @Select("select * from tb_user where id = #{id}")
    User getUserById(Long id);

    void insert(User user);

    void Update(User user);
    @Delete("delete from tb_user where id = #{id}")
    void delete(Long id);

    @Update("update tb_user set password = #{newPwd} where id = #{id}")
    void updatePwd(UserEditPwd userEditPwd);
}
